﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace StudentLive.Common
{
    class IconNameToImageConverter : IValueConverter
    {
        public string IconName { get; set; }

        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value == null) return null;
            this.IconName = value as string;
            var icon = App.Current.Resources[this.IconName];
            return (icon != null) ? icon : null;
        }
        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            return this.IconName;
        }
    }
}
